#ifndef EVENTLOOP_EVENTLOOPTHREADPOOL_H
#define EVENTLOOP_EVENTLOOPTHREADPOOL_H

#include "EventloopFwd.h"
#include "EventloopThreadFwd.h"
#include "utility/Noncopyable.h"

#include <memory>
#include <string>
#include <vector>

class EventloopThreadPool final {
public:
    EventloopThreadPool(Eventloop &loop, std::string name);
    ~EventloopThreadPool();

    void set_thread_count(std::size_t threadCount);

    Eventloop &next_loop();

    void init_start(const EventloopThreadInitFunc &initFunc);
    void start();
    void stop();

private:
    NONCOPYABLE(EventloopThreadPool);

    const std::string _name;
    std::vector<std::unique_ptr<EventloopThread>> _loopThreads;
    Eventloop &_baseloop;
    std::size_t _threadCount;
    std::size_t _next;
    bool _started;
};


#endif